<template>
	<div class="personalbox" style="background-color: white;padding: 30px;">
		<div class="title">个人资料</div>
		<div class="con" v-if="jurisdiction[0].status==true">
			<el-form class="cardboxList_box">
							<el-row :gutter="60">
		
								<el-col :span="20">
									<el-form-item label="登录账号" label-width="100px">
										<p style="float: left;">{{tableData.username}}</p>
										<div class="EdictUse" @click="handleClick(tableData)" v-if="jurisdiction[1].status==true">修改个人资料</div>
									</el-form-item>
								</el-col>
								<el-col :span="20">
									<el-form-item label="所属省市" label-width="100px">
										<p>{{tableData.province}}{{tableData.city}}</p>
									</el-form-item>
								</el-col>
								<el-col :span="20">
									<el-form-item label="手机号码" label-width="100px">
										<p>{{tableData.tel}}</p>
									</el-form-item>
								</el-col>
								<el-col :span="20">
									<el-form-item label="角色名称" label-width="100px">
										<p>{{tableData.rolename}}</p>
									</el-form-item>
								</el-col>
								<el-col :span="20">
									<el-form-item label="登录密码" label-width="100px">
										<p>**********</p>
										<div class="EdictUse" style="top: 0;" @click="showdialogVisible_password" v-if="jurisdiction[1].status==true">修改密码</div>
									</el-form-item>
								</el-col>
								<!-- <el-col :span="20">
									<el-form-item label="代理商分类" label-width="100px">
										<p>测试111</p>
									</el-form-item>
								</el-col>
								<el-col :span="20">
									<el-form-item label="权限区域" label-width="100px">
										<p>测试111</p>
									</el-form-item>
								</el-col>
								<el-col :span="20">
									<el-form-item label="查看区域" label-width="100px">
										<p>测试111</p>
									</el-form-item>
								</el-col> -->
								<el-col :span="20" style="margin-top: 20px;">
									<el-form-item label="营业执照" label-width="100px">
										<el-image style="width: 150px;height: 100px;" class="table-td-thumb" :src="tableData.yingyezhizhao_img"
											:preview-src-list="[tableData.yingyezhizhao_img]"></el-image>
									</el-form-item>
								</el-col>
								<el-col :span="20">
									<el-form-item label="经营许可证" label-width="100px">
										<el-image style="width: 150px;height: 100px;" class="table-td-thumb" :src="tableData.xuzhengzheng_img"
											:preview-src-list="[tableData.xuzhengzheng_img]"></el-image>
									</el-form-item>
								</el-col>
								<el-col :span="20">
									<el-form-item label="身份证照片" label-width="100px">
										<el-image style="width: 150px;height: 100px;margin-left: 0px;" class="table-td-thumb" :src="tableData.shenfezhengzhemgmian_img"
											:preview-src-list="[tableData.shenfezhengzhemgmian_img]"></el-image>
											<el-image style="width: 150px;height: 100px;margin-left: 30px;" class="table-td-thumb" :src="tableData.shenfenzhengfanmian_img"
												:preview-src-list="[tableData.shenfenzhengfanmian_img]"></el-image>
									</el-form-item>
								</el-col>
							</el-row>
			
						</el-form>
		</div>
		<div v-else style="margin-top: 100px;text-align: center;">
			<div>暂无数据</div>
		</div>
		<el-dialog title="修改密码" :visible.sync="dialogVisible_password">
			<div style="height: 300px;">
				<el-form>
					<el-row :gutter="60">
					<!-- 	<el-col :span="10">
							<el-form-item label="账号" label-width='80px'>
								<el-input style="width: 150px;" v-model="addform.username" type="text"></el-input>
							</el-form-item>
						</el-col> -->
						<el-col :span="20">
							<el-form-item label="新密码:" label-width='100px'>
								<el-input style="width: 90%;" type="text" v-model="addform.password"></el-input>
							</el-form-item>
						</el-col>
						
					</el-row>
				</el-form>
				<div slot="footer" class="dialog-footer" style="position: absolute;bottom: 20px;right: 30px;">
					<el-button style="width: 110px;" type="primary" @click="submitForm_password" size="small">确定</el-button>
					<el-button style="width: 110px;" @click="logCancel_1" size="small">取消</el-button>
				</div>
			</div>
		</el-dialog>
		<el-dialog :title="Texttitle" :visible.sync="dialogVisible">
					<el-form class="cardboxList_box">
						<el-row :gutter="60">
		
							<!-- <el-col :span="8">
								<el-form-item label="是否北京户口" label-width="100px">
									<el-select v-model="addform.beijinghukou" collapse-tags clearable placeholder="请选择"
										style="width: 150px;">
										<el-option v-for="item in yesOrnoOptions" :key="item.text" :label="item.text"
											:value="item.text">
										</el-option>
									</el-select>
								</el-form-item>
							</el-col>
		-->
							
							<el-col :span="10">
								<el-form-item label="登录账号" label-width="100px">
									<el-input readonly="readonly" style="width: 180px;" v-model="addform.username" type="text"></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="10">
								<el-form-item label="省" label-width="100px">
									 <el-select style="width: 180px;" v-model="sheng" clearable @change="choseProvince" placeholder="省">
								 　　   <el-option v-for="item in province" :key="item.id" :label="item.value" :value="item.id"></el-option>
							 　　   </el-select>
									<!-- <el-input style="width:180px;" v-model="addform.province" type="text"></el-input> -->
								</el-form-item>
							</el-col>
							<el-col :span="10">
								<el-form-item label="市" label-width="100px">
									<el-select style="width: 180px;" v-model="shi" clearable @change="choseCity" placeholder="市">
								 　　   <el-option v-for="item in shi1" :key="item.id" :label="item.value" :value="item.id"></el-option>
							   　　 </el-select>
								</el-form-item>
							</el-col>
							<el-col :span="10">
								<el-form-item label="手机号码" label-width="100px">
									<el-input style="width: 180px;" v-model="addform.tel" type="text"></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="10">
								<el-form-item label="角色名称" label-width="100px">
									<el-input readonly="readonly" style="width: 180px;" v-model="addform.rolename" type="text"></el-input>
								</el-form-item>
							</el-col>
							<!-- <el-col :span="10">
								<el-form-item label="代理商分类" label-width="100px">
									<el-input style="width: 180px;" v-model="addform.bed_number" type="text"></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="10">
								<el-form-item label="权限区域" label-width="100px">
									<el-input style="width: 180px;" v-model="addform.month_number" type="text"></el-input>
								</el-form-item>
							</el-col>
							<el-col :span="10">
								<el-form-item label="查看区域" label-width="100px">
									<el-input style="width: 180px;" v-model="addform.start_time" type="text"></el-input>
								</el-form-item>
							</el-col> -->
						</el-row>
						<el-row :gutter="60">
							<el-col :span="20">
								<el-form-item label="营业执照" label-width="138px">
									<el-image style="width: 150px;height: 100px;" class="table-td-thumb"
										:src="addform.yingyezhizhao_img" :preview-src-list="addform.yingyezhizhao_img"></el-image>
									<el-upload class="upload-demo" :action="uploadImgUrl" ref="upload" :file-list="fileList"
										:http-request="uploadSectionFile" :before-remove="handleRemove">
										<el-button size="small" type="primary">点击上传</el-button>
									</el-upload>
								</el-form-item>
							</el-col>
						
						</el-row>
						<el-row :gutter="60">
							<el-col :span="20">
								<el-form-item label="经营许可证" label-width="138px">
									<el-image style="width: 150px;height: 100px;" class="table-td-thumb"
										:src="addform.xuzhengzheng_img" :preview-src-list="addform.xuzhengzheng_img"></el-image>
									<el-upload class="upload-demo" :action="uploadImgUrl" ref="upload" :file-list="fileList_1"
										:http-request="uploadSectionFile1" :before-remove="handleRemove1">
										<el-button size="small" type="primary">点击上传</el-button>
									</el-upload>
								</el-form-item>
							</el-col>
						
						</el-row>
						<el-row :gutter="60">
							<el-col :span="10">
								<el-form-item label="身份证正面" label-width="138px">
									<el-image style="width: 150px;height: 100px;" class="table-td-thumb"
										:src="addform.shenfezhengzhemgmian_img" :preview-src-list="addform.shenfezhengzhemgmian_img"></el-image>
									<el-upload class="upload-demo" :action="uploadImgUrl" ref="upload" :file-list="fileList_3"
										:http-request="uploadSectionFile2" :before-remove="handleRemove2">
										<el-button size="small" type="primary">点击上传</el-button>
									</el-upload>
								</el-form-item>
							</el-col>
							<el-col :span="10">
								<el-form-item label="身份证反面" label-width="138px">
									<el-image style="width: 150px;height: 100px;" class="table-td-thumb"
										:src="addform.shenfenzhengfanmian_img" :preview-src-list="addform.shenfenzhengfanmian_img"></el-image>
									<el-upload class="upload-demo" :action="uploadImgUrl" ref="upload" :file-list="fileList_5"
										:http-request="uploadSectionFile3" :before-remove="handleRemove3">
										<el-button size="small" type="primary">点击上传</el-button>
									</el-upload>
								</el-form-item>
							</el-col>
						</el-row>
		
					</el-form>
					<div slot="footer" class="dialog-footer">
						<el-button type="primary" @click="submitForm_add" size="small">确定</el-button>
						<el-button @click="logCancel_2" size="small">取消</el-button>
					</div>
				</el-dialog>
	</div>
</template>

<script>
	import Schart from 'vue-schart';
	import bus from '../common/bus';
	import {
		uploadImg,
		// userviewOption,
		myuserList,
		myuserEdict,
	
	} from '../../api/index';
	export default {
		name: 'dashboard',
		data() {
			return {
				mapJson: require("../../assets/map.json") ,
				province: "",
				sheng: "",
				shi: "",
				shi1: [],
				qu: "",
				qu1: [],
				city: "",
				block: "",
				dialogVisible_password:false,
				jurisdiction:[],
				screenOptions: '',
				statistical: '', //统计
				uploadImgUrl: 'http://39.104.83.151/backstage/api/upload_image/',
				fileList: [],
				fileList1: [],
				
				fileList_1:[],
				fileList_2:[],
				
				fileList_3:[],
				fileList_4:[],
				
				fileList_5:[],
				fileList_6:[],
				Look_dataList: [],
				selectionbox: '',
				sexOptions: [{
						text: '男'
					},
					{
						text: '女'
					}
				],
				
				templateVisible: false,
				showViewer: false, // 显示查看器
				ruleForm: '',
				hideUp: '',
				nextProjectForm: {
					publicWelfareUrl: "",
				},
				Texttitle: "新增",
				page: 1,
				page_1: 1,
				form: {
					page: 1,
					size: 30,
					realname: undefined,
					company: undefined,
					
				},
				form1: { //模板数据
					page: 1,
					size: 30,
					province: undefined,
					user_id: undefined,
				},
				form2: { //模板数据
					page: 1,
					size: 30,
					template_info_id: undefined,
					user_id: undefined,
					template_id: undefined
				},
				addform: {
					out_trade_no: undefined, //报单编号
					hospital_name: undefined, //医院名称
					hospital_address: undefined, //医院地址
					department: undefined, //科室
					bed_number: undefined, //床位
					month_number: undefined, //月用量
					remarks1: undefined, //备注1
					remarks2: undefined, //备注2
					status: undefined, //状态
					start_time: undefined, //开始时间
					end_time: undefined //结束时间
				},
				addform_1: {
					province: '',
					user: '',
					get_set_ids: ''
				},
				
				childrow: '',
				childtypeflag: 1, //  1新增 2修改
				currentPage: 1, //初始页
				pagesize: 30, //  每页的数据
				pageTotal: '',
	
				currentPage_1: 1, //初始页
				pagesize_1: 30, //    每页的数据
				pageTotal_1: '',
	
				currentPage_2: 1, //初始页
				pagesize_2: 30, //    每页的数据
				pageTotal_2: '',
	
				dialogVisible: false,
				tableData: [],
				tableData_1: [],
				tableData_2: [],
	
				formitnanme: '',
				flagtype: 1,
				user_id: '',
				user_id_1: '',
				user_id_2: '',
				//详情
				dialogVisible_1: false,
				detailDataLog: '',
				detailrow: '',
	
				//添加记录
				addLogVisible: false,
				logInfo: '',
				value2: '',
				pickerOptions: {
					shortcuts: [{
						text: '今天',
						onClick(picker) {
							picker.$emit('pick', new Date());
						}
					}, {
						text: '昨天',
						onClick(picker) {
							const date = new Date();
							date.setTime(date.getTime() - 3600 * 1000 * 24);
							picker.$emit('pick', date);
						}
					}, {
						text: '一周前',
						onClick(picker) {
							const date = new Date();
							date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
							picker.$emit('pick', date);
						}
					}]
				},
				templateUser_id: '',
	
				deleteList_data: ''
			}
		},
		components: {
			Schart
		},
		computed: {
			role() {
				return this.name === 'admin' ? '超级管理员' : '普通用户';
			}
		},
		created() {
			console.log(666)
			// this.form.user_id=window.localStorage.getItem('user_id')
			this.getList()
			this.getCityData()
			// this.getuserviewOption()
			// this.getListCalculationview()
	
		},
		// activated() {
		//     this.handleListener();
		// },
		// deactivated() {
		//     window.removeEventListener('resize', this.renderChart);
		//     bus.$off('collapse', this.handleBus);
		// },
		methods: {
			
			
			getCityData:function(){
			            var that = this
						
			                    var data = that.mapJson
			                    that.province = []
			                    that.city = []
			                    that.block = []
			                    // 省市区数据分类
			                    for (var item in data) {
									
			                        if (item.match(/0000$/)) {//省
			                            that.province.push({id: item, value: data[item], children: []})
			                        } else if (item.match(/00$/)) {//市
			                            that.city.push({id: item, value: data[item], children: []})
			                        } else {//区
			                            that.block.push({id: item, value: data[item]})
			                        }
			                    }
			                    // 分类市级
			                    for (var index in that.province) {
			                        for (var index1 in that.city) {
			                            if (that.province[index].id.slice(0, 2) === that.city[index1].id.slice(0, 2)) {
			                                that.province[index].children.push(that.city[index1])
			                            }
			                        }
			                    }
			                    // 分类区级
			                    for(var item1 in that.city) {
			                        for(var item2 in that.block) {
			                            if (that.block[item2].id.slice(0, 4) === that.city[item1].id.slice(0, 4)) {
			                                that.city[item1].children.push(that.block[item2])
			                            }
			                        }
			                    }
			              
			        },
			        // 选省
			        choseProvince:function(e) {
			            for (var index2 in this.province) {
			                if (e === this.province[index2].id) {
			                    console.log(this.province[index2].id)//你选择的省级编码
			                    console.log(this.province[index2].value)//省级编码 对应的汉字 
								this.addform.province=this.province[index2].value
			                    this.shi1 = this.province[index2].children
			                    // this.shi = this.province[index2].children[0].value
			                    // this.qu1 =this.province[index2].children[0].children
			                    // this.qu = this.province[index2].children[0].children[0].value
			                    // this.E = this.qu1[0].id
			                }
			            }
			        },
			        // 选市
			        choseCity:function(e) {
			            for (var index3 in this.city) {
			                if (e === this.city[index3].id) {
								
								this.addform.city=this.city[index3].value
			                    this.qu1 = this.city[index3].children
			                    this.qu = this.city[index3].children[0].value
			                    this.E = this.qu1[0].id
			                }
			            }
			        },
			        // 选区
			        choseBlock:function(e) {
			            this.E=e;
			        },
			showdialogVisible_password(){
				this.dialogVisible_password = true
			},
			
			//修改密码
			submitForm_password(){
				let that = this
				let query=that.addform
				myuserEdict(query.user_id, query).then(res => {
					that.dialogVisible_password = false
					that.$message({
						message: '修改成功！',
						type: 'success'
					});
					that.getList()
				});
			},
	
			//获取筛选条件
			getuserviewOption() {
				let that = this
				let query;
				query = {}
				console.log(query)
				userviewOption(query).then(res => {
					console.log("筛选条件", res);
	
					let company = []
					for (var i = 0; i < res.company.length; i++) {
						let obj = {
							text: res.company[i]
						}
						company.push(obj)
					}
					let constellation = []
					for (var i = 0; i < res.constellation.length; i++) {
						let obj = {
							text: res.constellation[i]
						}
						constellation.push(obj)
					}
					let education = []
					for (var i = 0; i < res.education.length; i++) {
						let obj = {
							text: res.education[i]
						}
						education.push(obj)
					}
					let age = []
					for (var i = 0; i < res.age.length; i++) {
						let obj = {
							text: res.age[i]
						}
						age.push(obj)
					}
					let current_residence = []
					for (var i = 0; i < res.current_residence.length; i++) {
						let obj = {
							text: res.current_residence[i]
						}
						current_residence.push(obj)
					}
					res.company = company
					res.constellation = constellation
					res.education = education
					res.age = age
					res.company = company
					res.current_residence = current_residence
					this.screenOptions = res
	
				});
			},
	
			getRowKeys(row) {
				return row.user_id
			},
	
			handleChange(selection) {
				console.log(selection)
				this.deleteList_data = selection
			},
	
			//批量删除
			deleteList() {
				let that = this
				let ids = []
				let arr = this.deleteList_data
				for (var i = 0; i < arr.length; i++) {
					ids.push(arr[i].user_id)
				}
				that.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					let parms = {
						ids: ids.toString()
					}
					batch_delete(parms).then(res => {
						console.log("批量删除", res)
						that.dialogVisible = false
						if (res.code == 0) {
							that.$message({
								message: '批量删除成功！',
								type: 'success'
							});
							that.getList()
						}
	
						// this.tableData = res.list;
						// this.pageTotal = res.pageTotal || 50;
					});
	
				}).catch(() => {
					that.$message({
						type: 'info',
						message: '已取消删除'
					});
				});
	
	
			},
	
			//批量导出
			export_excel_userList() {
				let that = this
				let ids = []
				let arr = this.deleteList_data
				for (var i = 0; i < arr.length; i++) {
					ids.push(arr[i].user_id)
				}
	
				let parms = {
					ids: ids.toString()
				}
				window.location.href = 'https://www.whhdb2022.com/backstage/api/userview/export_excel/?ids=' + ids
					.toString()
				// export_excel_user(parms).then(res => {
				// 	console.log("批量导出", res)
				// 	that.dialogVisible = false
				// 	if (res.code == 0) {
				// 		that.$message({
				// 			message: '批量导出成功！',
				// 			type: 'success'
				// 		});
				// 		that.getList()
				// 	}
	
				// 	// this.tableData = res.list;
				// 	// this.pageTotal = res.pageTotal || 50;
				// });
	
	
			},
	
			getListCalculationview() {
				let that = this
				let query;
				query = {}
				console.log(query)
				calculationview(query).then(res => {
					console.log("审核", res);
					that.statistical = res
				});
			},
			uploadSectionFile(param) {
				var fileObj = param.file;
				// FormData 对象
				var form = new FormData();
				// 文件对象
				form.append("image", fileObj);
				uploadImg(form).then(res => {
					console.log("上传图片", res)
					this.addform.yingyezhizhao_img = res.url
					this.$message({
						message: '上传成功！',
						type: 'success'
					});
				});
			},
			handleRemove(file, fileList) {
				this.addform.yingyezhizhao_img = "";
				this.fileList = [];
				this.fileList1 = [];
				this.hideUp = false;
			},
			
			uploadSectionFile1(param) {
				var fileObj = param.file;
				// FormData 对象
				var form = new FormData();
				// 文件对象
				form.append("image", fileObj);
				uploadImg(form).then(res => {
					console.log("上传图片", res)
					this.addform.xuzhengzheng_img = res.url
					this.$message({
						message: '上传成功！',
						type: 'success'
					});
				});
			},
			handleRemove1(file, fileList) {
				this.addform.xuzhengzheng_img = "";
				this.fileList_1 = [];
				this.fileList_2 = [];
				this.hideUp = false;
			},
			uploadSectionFile2(param) {
				var fileObj = param.file;
				// FormData 对象
				var form = new FormData();
				// 文件对象
				form.append("image", fileObj);
				uploadImg(form).then(res => {
					console.log("上传图片", res)
					this.addform.shenfezhengzhemgmian_img = res.url
					this.$message({
						message: '上传成功！',
						type: 'success'
					});
				});
			},
			handleRemove2(file, fileList) {
				this.addform.shenfezhengzhemgmian_img = "";
				this.fileList_3 = [];
				this.fileList_4 = [];
				this.hideUp = false;
			},
			
			uploadSectionFile3(param) {
				var fileObj = param.file;
				// FormData 对象
				var form = new FormData();
				// 文件对象
				form.append("image", fileObj);
				uploadImg(form).then(res => {
					console.log("上传图片", res)
					this.addform.shenfenzhengfanmian_img = res.url
					this.$message({
						message: '上传成功！',
						type: 'success'
					});
				});
			},
			handleRemove3(file, fileList) {
				this.addform.shenfenzhengfanmian_img = "";
				this.fileList_5 = [];
				this.fileList_6 = [];
				this.hideUp = false;
			},
	
			//列表选择导出
			handleSelectionChange(selection) {
				var selectionbox = selection.map(function(car) {
					return car.template_info_id;
				})
				console.log(selectionbox)
				this.selectionbox = selectionbox.toString()
			},
			groupEdict() {
				if (this.selectionbox == '') {
					this.$message.error('请选择模板！');
				} else {
					this.templateVisibledetail_add_1 = true
					this.templatedetailLog = '批量编辑'
					this.templateDetailFlagtype = 3
					this.addform_2 = {
						method: undefined,
						weight_start: undefined,
						weight_end: undefined,
						date_start: undefined,
						date_end: undefined,
						first_weight: undefined,
						continued_weight: undefined,
						template: undefined,
						user: undefined,
					}
				}
			},
			//数据模板
			templateClick(row) {
				console.log(row)
				this.templateUser_id = row.user_id
				this.addform_1.user = row.user_id
				this.templateList(row.user_id)
				this.templateVisible = true
			},
			//数据模板列表
			templateList(user_id) {
				let that = this
				that.form1.user_id = user_id
				let query;
				query = this.form1
				console.log(query)
				templateviewList(query).then(res => {
	
					that.tableData_1 = res.results;
					that.pageTotal_1 = res.count
					console.log("模板列表1111", that.pageTotal_1);
				});
			},
	
			//数据模板(新增)
			showTemplatePop() {
				this.templateVisible_add = true
				this.templateLog = '新增'
				this.templateFlagtype = 1
				this.addform_1.province = undefined
			},
			
	
			//重置
			restSearch() {
				this.form = {
						page: 1,
						size: 30,
						realname: undefined,
						company: undefined,
						nation: undefined,
						marriage_history: undefined,
						education: undefined,
						constellation: undefined,
						sex: undefined,
						age: undefined,
					},
	
					this.getList()
			},
	
			//导出
			exportexelBtn() {
				let query = {}
				exportexel(query).then(res => {
					console.log("导出", res)
				});
	
			},
	
			dataSearch() {
				this.formatDate(that.value2)
			},
			//添加记录
			showLogdilog(row, type) {
				this.childtypeflag = type
				this.addLogVisible = true
				if (type == 2) {
					this.childrow = row
					this.addformchild = row
					this.uploadimgurl = row.img
				}
	
			},
	
			addLogcancel() {
				this.addLogVisible = false
			},
	
			//确认添加操作日志
			addLogBtn() {
				let that = this
				let query = this.addformchild
				query.personnel = this.detailrow.personnel_id
				console.log("确认添加操作日志", query)
				console.log(query)
				if (this.childtypeflag == 1) {
					detailAdd(query).then(res => {
						that.addLogVisible = false
						that.$message({
							message: '添加成功！',
							type: 'success'
						});
						that.detailClick(that.detailrow)
					});
				} else {
					detailEdict(query.personnel_logs_id, query).then(res => {
						that.addLogVisible = false
						that.$message({
							message: '修改成功！',
							type: 'success'
						});
						that.detailClick(that.detailrow)
					});
				}
	
			},
	
	
			handleSizeChange: function(size) {
				this.pagesize = size;
				this.form.size = size
				console.log(this.pagesize) //每页下拉显示数据
				this.getList()
			},
			handleCurrentChange: function(currentPage) {
				this.currentPage = currentPage;
				console.log(this.currentPage) //点击第几页
				this.form.page = currentPage
				this.getList()
			},
			handleSizeChange_1: function(size) {
				this.pagesize_1 = size;
				this.form1.size = size
				this.templateList(this.templateUser_id)
			},
			handleCurrentChange_1: function(currentPage) {
				this.currentPage_1 = currentPage;
				console.log(this.currentPage_1) //点击第几页
				this.page_1 = currentPage
				this.form1.page = currentPage
				this.templateList(this.templateUser_id)
			},
	
			handleSizeChange_2: function(size) {
				this.pagesize_2 = size;
				this.form2.size = size
				this.templateDetailClick()
			},
			handleCurrentChange_2: function(currentPage) {
				this.currentPage_2 = currentPage;
				console.log(this.currentPage_2) //点击第几页
				this.page_2 = currentPage
				this.form2.page = currentPage
				this.templateDetailClick()
			},
			showdialogVisible() {
				this.Texttitle = '新增'
				this.addform = {
					realname: undefined,
					company: undefined,
					department: undefined,
					job_card_img: undefined,
					sex: undefined,
					height: undefined,
					weight: undefined,
					birthday: undefined,
					age: undefined,
					
				}
				this.user_id = ''
				this.dialogVisible = true
				this.flagtype = 1
			},
	
	
			//s删除
			deleteThis(row) {
				let that = this
				that.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					let query = {
						"report_id": row.report_id,
					}
					reportDelete(row.report_id, query).then(res => {
						that.dialogVisible = false
						if (res.code == 0) {
							that.$message({
								message: '删除成功！',
								type: 'success'
							});
							that.getList()
						}
	
						// this.tableData = res.list;
						// this.pageTotal = res.pageTotal || 50;
					});
				}).catch(() => {
					that.$message({
						type: 'info',
						message: '已取消删除'
					});
				});
			},
			//编辑
			handleClick(row) {
				console.log("编辑", row)
				this.Texttitle = '编辑'
				this.flagtype = 2
				this.dialogVisible = true
				this.addform = row
	            this.sheng=row.province
	             this.shi=row.city
				this.user_id = row.user_id
			},
	
	
			//关闭新增弹窗
			logCancel_1() {
				this.dialogVisible_password = false
			},
			logCancel_2() {
				this.dialogVisible = false
			},
			logCancel_3() {
				this.templateVisibledetail_add_1 = false
			},
	
			//新增用户
			submitForm_add() {
				console.log("新增记录", this.addform)
				// if (this.addform.username == '' || this.addform.username == undefined) {
				// 	this.$message.error('请输入姓名');
				// } else {
				this.addform.start_time = this.formatDate(this.addform.start_time)
				this.addform.end_time = this.formatDate(this.addform.end_time)
				if (this.flagtype == 1) {
		
					myreportAdd(this.addform).then(res => {
						console.log("新增", res)
						this.dialogVisible = false
						if (res.code == 0) {
							this.$message({
								message: '新增成功！',
								type: 'success'
							});
							this.getList()
						}
	
						// this.tableData = res.list;
						// this.pageTotal = res.pageTotal || 50;
					});
				} else {
					myuserEdict(this.user_id, this.addform).then(res => {
						console.log("修改", res)
						this.dialogVisible = false
						if (res.code == 0) {
							this.$message({
								message: '修改成功！',
								type: 'success'
							});
							this.getList()
						}
	
						// this.tableData = res.list;
						// this.pageTotal = res.pageTotal || 50;
					});
				}
	
	
			},
			getList() {
				let that = this
				let query;
				console.log('参数', that.form)
	
				// if (query.company) {
				// 	query.company = query.company.toString()
				// }
	
				console.log(query)
				myuserList(query).then(res => {
					console.log("个人中心", res);
					that.tableData = res.results;
					that.addform = res.results
					that.jurisdiction=res.jurisdiction
					that.pageTotal = res.count
				});
			},
			formatTen(num) {
				return num > 9 ? (num + "") : ("0" + num);
			},
			formatDate(date) {
				console.log("时间", date)
				var date = new Date(date)
				var year = date.getFullYear();
				var month = date.getMonth() + 1;
				var day = date.getDate();
				var hour = date.getHours();
				var minute = date.getMinutes();
				var second = date.getSeconds();
	
				return year + "-" + this.formatTen(month) + "-" + this.formatTen(
					day) + " " + this.formatTen(hour) + ":" +this.formatTen(minute) //+ ":" + this.formatTen(second);
								console.log(333, year + "-" + this.formatTen(month) + "-" + this.formatTen(day))
			},
			changeDate() {
				const now = new Date().getTime();
				this.data.forEach((item, index) => {
					const date = new Date(now - (6 - index) * 86400000);
					item.name = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
				});
			}
	
		}
	};
</script>

<style lang="scss" scoped>
	.personalbox{
		.title{
			width: 95%;
			height: 40px;
			line-height: 40px;
			border-bottom: 1px solid #eee;
		}
		.con{
			margin-top: 30px;
		}
	}
	.el-form-item{
		margin-bottom: 10px;
	}
	.con /deep/ .el-form-item__label{
		color: #999 !important;
		margin-right: 30px;
	}
	.con /deep/ .el-form-item__content{
		position: relative;
	}
	.EdictUse{
		width: 120px;
		height: 28px;
		line-height: 28px;
		border-radius: 28px;
		background-color: #B2CCFF;
		color: #3B7CFF;
		text-align: center;
		position: absolute;
		left: 100px;
		margin-left: 100px;
		font-size: 12px;
		z-index: 100;
		cursor: pointer;
	}
	/deep/ .el-upload-list {
		display: none;
	}
	
	/deep/ .el-pagination__sizes {
		display: none !important;
	}
	
	/deep/ .el-upload--text {
		width: inherit !important;
		height: inherit !important;
	}
	
	.edict_row_title {
		width: 100%;
		height: 80px;
		line-height: 100px;
		margin: auto;
		font-weight: bold;
	}
	
	.avatar-uploader .el-upload {
		border: 1px dashed #d9d9d9;
		border-radius: 6px;
		cursor: pointer;
		position: relative;
		overflow: hidden;
	}
	
	.avatar-uploader .el-upload:hover {
		border-color: #409eff;
	}
	
	.avatar-uploader-icon {
		font-size: 28px;
		color: #8c939d;
		width: 178px;
		height: 178px;
		line-height: 178px;
		text-align: center;
	}
	
	.avatar {
		width: 178px;
		height: 178px;
		display: block;
	}
	
	.headercon {
		height: 40px;
		margin-top: 20px;
		margin-bottom: 40px;
	}
	
	.el-upload {
		width: 100px;
	}
	
	.el-row {
		margin-bottom: 20px;
	}
	
	.grid-content {
		display: flex;
		align-items: center;
		height: 40px;
	}
	
	.grid-cont-right {
		flex: 1;
		text-align: center;
		font-size: 14px;
		color: #999;
	}
	
	.grid-num {
		font-size: 30px;
		font-weight: bold;
	}
	
	.grid-con-icon {
		font-size: 50px;
		width: 100px;
		height: 100px;
		text-align: center;
		line-height: 100px;
		color: #fff;
	}
	
	.grid-con-1 .grid-con-icon {
		background: rgb(45, 140, 240);
	}
	
	.grid-con-1 .grid-num {
		color: rgb(45, 140, 240);
	}
	
	.grid-con-2 .grid-con-icon {
		background: rgb(100, 213, 114);
	}
	
	.grid-con-2 .grid-num {
		color: rgb(45, 140, 240);
	}
	
	.grid-con-3 .grid-con-icon {
		background: rgb(242, 94, 67);
	}
	
	.grid-con-3 .grid-num {
		color: rgb(242, 94, 67);
	}
	
	.user-info {
		display: flex;
		align-items: center;
		padding-bottom: 20px;
		border-bottom: 2px solid #ccc;
		margin-bottom: 20px;
	}
	
	.user-avator {
		width: 120px;
		height: 120px;
		border-radius: 50%;
	}
	
	.user-info-cont {
		padding-left: 50px;
		flex: 1;
		font-size: 14px;
		color: #999;
	}
	
	.user-info-cont div:first-child {
		font-size: 30px;
		color: #222;
	}
	
	.user-info-list {
		font-size: 14px;
		color: #999;
		line-height: 25px;
	}
	
	.user-info-list span {
		margin-left: 70px;
	}
	
	.mgb20 {
		margin-bottom: 20px;
	}
	
	.todo-item {
		font-size: 14px;
	}
	
	.todo-item-del {
		text-decoration: line-through;
		color: #999;
	}
	
	.schart {
		width: 100%;
		height: 300px;
	}
	
	.delete {
		color: red;
	}
	
	.dialog-footer {
		text-align: right;
	}
</style>
